package com.humanresource.exception;

import com.humanresource.enums.ResultEnum;

/**
 * 定义自己的异常
 * @author zhihu
 * 继承RuntimeException(RuntimeException继承Exception),
 * Spring框架会对RuntimeException进行事务回滚,而不会对Exception进行事务回滚
 *
 */
public class RunException extends RuntimeException {
	private Integer code;

	public RunException(ResultEnum resultEnum) {
		super(resultEnum.getMsg());
		this.code = resultEnum.getCode();
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}
}
